#!/bin/bash

if [ "$1" == "start" ]; then
	sleep 15
	while ! `mkdir $olsr_lock_dir`; do 
		echo "Waiting for lock"
		sleep 1; 
		date; 
	done;

	rm /var/run/olsrd-ipv4.lock
	rm /etc/olsrd.conf.lock
	rm /etc/olsrd/olsrd.conf.lock
	#./olsrd-0.6.1/olsrd  -f lxc_configs/olsrd-$1.conf -d $DEBUG -bcast 10.255.255.255 &
	echo "Starting olsrd"
	../../olsrd-0.6.3/olsrd  -f ../guest_temp/olsrd_${node_id}.conf -d $olsr_debug -bcast 10.0.0.255 &
	rmdir $olsr_lock_dir
	sleep 1
fi